create or replace type m4o_buffer as object (

  m_handle number,

  -- ===========================================================================
  constructor function m4o_buffer(
    i_subst_start_tag in varchar2 := '{',
    i_subst_end_tag   in varchar2 := '}')
  return self as result,

  -- ===========================================================================
  member procedure free(self in out nocopy m4o_buffer),

  -- ===========================================================================
  -- clear buffer space, preserving substitutions
  member procedure clear,

  -- ===========================================================================
  -- put i_str||chr(10) at the end of the string. substitution arguments get
  -- replaced.
  member procedure p(
    i_str in varchar2,
    i_fmt in boolean := true),

  -- ===========================================================================
  member procedure set_subst(
    i_key   in varchar2,
    i_value in varchar2),
  -- ===========================================================================
  member function fmt(i_str in varchar2) return varchar2,

  -- ===========================================================================
  member function get_str return varchar2
)
/
